<%@page language="java" pageEncoding="UTF-8"
	contentType="text/html; charset=UTF-8"%>
<%@ include file="/view/common/taglib.jsp"%>
<%@ include file="/view/common/variable.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<%@ include file="/view/common/head.jsp"%>
<meta name="keywords" content="学而阅读,小说网,原创小说网" />
<meta name="description"
	content="学而阅读,最热门的免费小说网站,提供武侠仙侠,奇幻玄幻,科幻灵异,都市言情,穿越女频,青春校园,历史军事,网游竞技,职业官场等网络热门的书籍下载跟阅读！" />
<title>学而阅读作家后台</title>
<link type="text/css" rel="stylesheet" href="${path}/css/login.css" />
<script type="text/javascript" src="${path}/js/area.js"></script>
<script type="text/javascript">
	$(document).ready(function() {

	});
	function register() {
		var accounts = $("#accounts").val();
		var password = $("#password").val();
		var name = $("#name").val();
		var pseudonym = $("#pseudonym").val();
		var qq = $("#qq").val();
		var mobile = $("#mobile").val();
		var city=$("#s_province").val()+$("#s_city").val()+$("#s_county").val();
		var add = $("#add").val();
		var carded = $("#carded").val();
		var bank = $("#bank").val();
		var bankaccounts = $("#bankaccounts").val();
		if (!accounts) {
			$("#tipinfo").text("请填写作者帐号!");
			return false;
		}
		if (!password) {
			$("#tipinfo").text("请填写帐号密码!");
			return false;
		}
		if (!name) {
			$("#tipinfo").text("请填写真实姓名!");
			return false;
		}
		if (!pseudonym) {
			$("#tipinfo").text("请填写作者笔名!");
			return false;
		}
		if (!qq) {
			$("#tipinfo").text("请填写作者QQ!");
			return false;
		}
		if (!mobile) {
			$("#tipinfo").text("请填写手机号码!");
			return false;
		}
		if (!verify('mobile', mobile)) {
			$("#tipinfo").text("请填写正确的手机号码!");
			return false;
		}
		if (!add) {
			$("#tipinfo").text("请填写详细地址!");
			return false;
		}
		if (!carded) {
			$("#tipinfo").text("请填写身份证号!");
			return false;
		}
		if (!verify('carded', carded)) {
			$("#tipinfo").text("请填写正确的身份证号!");
			return false;
		}
		if (!bank) {
			$("#tipinfo").text("请填写开户银行!");
			return false;
		}
		if (!bankaccounts) {
			$("#tipinfo").text("请填写银行帐号!");
			return false;
		}
		
		$("#authorCity").val(city);
		$.post($("#form1").attr("action"), $("#form1").serialize(), function(
				data) {
			var result = $.parseJSON(data);
			if (result.code == 0) {
				window.location.href = result.url;
			} else {
				$("#tipinfo").text(result.message);

				return false;
			}
		});
	}

	function verify(type, value) {
		//手机号
		if (type == "mobile") {
			var isValid = /^(((13[0-9]{1})|(15[0-9]{1})|(18[0-9]{1})|(176)|(177)|(178))+\d{8})$/
					.test(value);
			return isValid;
		}
		//身份证号
		else if (type == "carded") {
			var isValid = /^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}$|^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X)$/
					.test(value);
			return isValid;
		} else {
			return false;
		}
	}
</script>

<style>
.regn {
	text-align: center;
	padding-top: 0px;
	float: right;
	margin-top: -100px;
	padding-bottom: 40px;
}

.regn ul {
	display: inline-block;
}

.regn ul li {
	overflow: hidden;
	height: 40px;
	padding-bottom: 36px;
}

.regn ul li input {
	font-size: 14px;
	border: solid 1px #e5e5e5;
	line-height: 38px;
	padding-left: 14px;
}

.regn ul li em {
	float: left;
	text-align: right;
	margin-right: 24px;
	width: 60px;
	color: #000000;
	font-size: 14px;
	line-height: 40px;
}

.regn ul li div {
	float: left;
}

.regn ul li div.mobilephone {
	overflow: hidden;
	line-height: 38px;
}

.regn ul li div.mobilephone b {
	float: left;
	border: solid 1px #e5e5e5;
	width: 148px;
	height: 38px;
	font-weight: normal;
	text-align: left;
	font-size: 14px;
	padding-left: 14px;
}

.regn ul li div.mobilephone input {
	float: left;
	border: solid 1px #e5e5e5;
	height: 38px;
	padding-left: 14px;
	width: 166px;
}

.regn ul li {
	height: auto;
	padding-bottom: 10px;
}

.regn ul li em {
	float: left;
	text-align: right;
	margin-right: 24px;
	width: 60px;
	color: #000000;
	font-size: 14px;
	line-height: 36px;
}

.regn ul li div.mobilephone input {
	float: left;
	border: solid 1px #e5e5e5;
	height: 34px;
	padding-left: 14px;
	line-height: 30px;
	width: 166px;
}

.regn ul li span {
	line-height: 36px;
	color: red;
	padding-left: 10px;
}

.regn ul li input {
	width: 326px;
}

.regn ul li div.mobilephone input {
	width: 326px;
}

.regn ul li textarea {
	width: 324px;
	border: solid 1px #e5e5e5;
	height: 100px;
	padding-left: 14px;
}

.regn ul li select {
	border: solid 1px #e5e5e5;
	height: 36px;
	max-width: 120px;
}

.regn ul li .regsub {
	width: 100%;
	height: 40px;
	line-height: 38px;
	color: #ffffff;
	text-align: center;
	font-size: 18px;
	background: #14cca3;
	cursor: pointer;
	display: block;
}
</style>
</head>

<body ng-app="myApp" ng-controller="myCtrl"
	style="background-color: #ffffff;">
	<div class="dtop">
		<div class="dtopn">
			<b><a><img src="<%=path%>/image/loginlogo.png" /></a></b> <i></i> <em>注册</em>
		</div>
	</div>
	<div class="campaign">
		<b style="margin-right: 0px;"><img
			src="<%=path%>/image/campaign.png" /></b>
		<div class="regn">
			<form id="form1" name="form1" method="post"
				action="<%=path%>/author/register">
				<input type="hidden" id="authorCity" name="authorCity" value="" />
				<ul>
					<li><em>作者帐号</em>
						<div class="mobilephone">
							<input type="text" placeholder="作者帐号" id="accounts"
								name="authorAccount" />
						</div> <span>*</span></li>
					<li><em>帐号密码</em>
						<div class="mobilephone">
							<input type="password" placeholder="帐号密码" id="password"
								name="authorPassword" />
						</div> <span>*</span></li>
					<li><em>真实姓名</em>
						<div class="mobilephone">
							<input type="text" placeholder="真实姓名" id="name" name="authorName" />
						</div> <span>*</span></li>
					<li><em>作者笔名</em>
						<div class="mobilephone">
							<input type="text" placeholder="作者笔名" id="pseudonym"
								name="authorNickname" /><span>*</span>
						</div></li>
					<li><em>作者性别</em>
						<div class="mobilephone">
							<input type="radio" name="authorGender" value="0"
								style="width: auto; float: none; height: auto;"
								checked="checked" /><i
								style="padding: 0 10px; top: -2px; position: relative;">未设置</i><input
								type="radio" name="authorGender" value="1"
								style="width: auto; float: none; height: auto;" /><i
								style="padding: 0 10px; top: -2px; position: relative;">男</i><input
								type="radio" name="authorGender" value="2"
								style="width: auto; float: none; height: auto;" /><i
								style="padding: 0 10px; top: -2px; position: relative;">女</i>
						</div></li>

					<li><em>作者QQ</em>
						<div class="mobilephone">
							<input type="text" placeholder="作者QQ" id="qq" name="authorQQ" /><span>*</span>
						</div></li>
					<li><em>作者邮箱</em>
						<div class="mobilephone">
							<input type="text" placeholder="作者邮箱" id="mailbox"
								name="authorEmail" />
						</div></li>
					<li><em>手机号码</em>
						<div class="mobilephone">
							<input type="text" placeholder="手机号码" id="mobile"
								name="authorPhone" /><span>*</span>
						</div></li>
					<li><em>省份市区</em>
						<div class="mobilephone">
							<select id="s_province" name="s_province"></select> <select
								id="s_city" name="s_city"></select> <select id="s_county"
								name="s_county"></select>
							<script class="resources library" src="./js/area.js"
								type="text/javascript"></script>
							<script type="text/javascript">
								_init_area();
							</script>
						</div></li>
					<li><em>详细地址</em>
						<div class="mobilephone">
							<input type="text" placeholder="详细地址" id="add"
								name="authorAddress" /><span>*</span>
						</div></li>
					<li><em>身份证号</em>
						<div class="mobilephone">
							<input type="text" placeholder="身份证号" id="carded"
								name="authorIDCard" /><span>*</span>
						</div></li>
					<li><em>开户银行</em>
						<div class="mobilephone">
							<input type="text" placeholder="开户银行" id="bank" name="authorBankName" /><span>*</span>
						</div></li>
					<li><em>银行帐号</em>
						<div class="mobilephone">
							<input type="text" placeholder="银行帐号" id="bankaccounts"
								name="authorBankNumber" /><span>*</span>
						</div></li>
					<li><em>作者签名</em>
						<div class="mobilephone">
							<textarea placeholder="作者签名" name="authorSign"></textarea>

						</div></li>

					<li><span id="tipinfo" style="color: red;"></span></li>
					<li><a class="regsub" onclick="register()">立即注册</a></li>
					<li style="padding-top: 10px; text-align: left; font-size: 14px;"><a href="${path}/author/toLogin">返回登录</a></li>
				</ul>
			</form>
		</div>
	</div>
</body>
</html>